package iedcyt.acute.controller.listeners.signComparison;

import iedcyt.acute.model.SignComparisonModel;
import iedcyt.acute.view.SignComparisionView;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

public class PrevSelectionListener extends SelectionAdapter {

	private SignComparisonModel _model;
	private SignComparisionView _view;
	
	public PrevSelectionListener(SignComparisionView view, SignComparisonModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void widgetSelected(SelectionEvent event) {
		_model.prevPage();
		
		_view.loadAuthors(_model.getAuthors());
		_view.loadSigns1(_model.getAuthorSigns1());
		_view.loadDocuments1(_model.getSign1Docs());
		_view.loadCenters1(_model.getSign1Centers(), _model.isSign1CentersWarning());
		_view.loadCorps1(_model.getSign1Corps(), _model.isSign1CorpsWarning());
		_view.loadSignsCollaborators1(_model.getSign1CollSigns());
		_view.loadAuthorsCollaborators1(_model.getSign1CollAuthors());
		
		_view.loadSigns2(_model.getAuthorSigns2());
		_view.loadDocuments2(_model.getSign2Docs());
		_view.loadCenters2(_model.getSign2Centers(), _model.isSign2CentersWarning());
		_view.loadCorps2(_model.getSign2Corps(), _model.isSign2CorpsWarning());
		_view.loadSignsCollaborators2(_model.getSign2CollSigns());
		_view.loadAuthorsCollaborators2(_model.getSign2CollAuthors());
		
		_view.compareTables();
	}
}
